package com.example.kotlindemo.范性;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

public class GenericJava {

    static class InnerClass<T>{

    }

    //范性擦除 原理

    public static void main(String[] args) {
        InnerClass<Integer> integerInnerClass = new InnerClass<>();
        Type genericSuperclass = integerInnerClass.getClass().getGenericSuperclass();
        System.out.println(genericSuperclass);

        if(genericSuperclass instanceof ParameterizedType){
            Type actualTypeArgument = ((ParameterizedType) integerInnerClass).getActualTypeArguments()[0];
            System.out.println(actualTypeArgument);
        }
    }
}
